VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{B3FB64BF-91F9-11D7-A482-0008A14158BC}#2.22#0"; "ITGControls.ocx"
Begin VB.Form frmToolChangeProduct 
   BackColor       =   &H00F7D9C2&
   BorderStyle     =   0  'None
   ClientHeight    =   3765
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   5385
   BeginProperty Font 
      Name            =   "Tahoma"
      Size            =   8.25
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3765
   ScaleWidth      =   5385
   ShowInTaskbar   =   0   'False
   StartUpPosition =   3  'Windows Default
   Begin VB.CheckBox chkDelete 
      BackColor       =   &H00F7D9C2&
      Caption         =   "Delete old product"
      Height          =   255
      Left            =   240
      TabIndex        =   11
      Top             =   2880
      Value           =   1  'Checked
      Width           =   3735
   End
   Begin VB.Frame Frame2 
      BackColor       =   &H00F7D9C2&
      Caption         =   "To"
      Height          =   1215
      Left            =   120
      TabIndex        =   2
      Top             =   1560
      Width           =   5055
      Begin VB.CommandButton cmdPickTo 
         Height          =   300
         Left            =   2745
         Picture         =   "frmToolChangeProduct.frx":0000
         Style           =   1  'Graphical
         TabIndex        =   7
         Top             =   375
         Width           =   345
      End
      Begin ITGControls.ITGTextBox txtToDesc 
         Height          =   285
         Left            =   120
         TabIndex        =   8
         Top             =   735
         Width           =   4845
         _ExtentX        =   8334
         _ExtentY        =   503
         LabelBackColor  =   16243138
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Label           =   "Description"
         BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         LabelWidth      =   1280
         TextBoxWidth    =   3505
         Enabled         =   0   'False
      End
      Begin ITGControls.ITGTextBox txtToCode 
         Height          =   285
         Left            =   150
         TabIndex        =   9
         Top             =   360
         Width           =   2580
         _ExtentX        =   4339
         _ExtentY        =   503
         SendKeysTab     =   -1  'True
         LabelBackColor  =   16243138
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         AllCaps         =   -1  'True
         Label           =   "Item No."
         BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         LabelWidth      =   1280
         TextBoxWidth    =   1240
      End
      Begin ITGControls.ITGTextBox txtToPart 
         Height          =   285
         Left            =   3120
         TabIndex        =   10
         Top             =   360
         Width           =   1830
         _ExtentX        =   3122
         _ExtentY        =   503
         LabelBackColor  =   16243138
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Label           =   ""
         BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         LabelWidth      =   0
         TextBoxWidth    =   1770
         Enabled         =   0   'False
      End
   End
   Begin VB.Frame Frame1 
      BackColor       =   &H00F7D9C2&
      Caption         =   "From"
      Height          =   1215
      Left            =   120
      TabIndex        =   1
      Top             =   240
      Width           =   5055
      Begin VB.CommandButton cmdPickFrom 
         Height          =   300
         Left            =   2715
         Picture         =   "frmToolChangeProduct.frx":014A
         Style           =   1  'Graphical
         TabIndex        =   3
         Top             =   375
         Width           =   345
      End
      Begin ITGControls.ITGTextBox txtFromDesc 
         Height          =   285
         Left            =   90
         TabIndex        =   4
         Top             =   735
         Width           =   4845
         _ExtentX        =   8334
         _ExtentY        =   503
         BackColor       =   14737632
         LabelBackColor  =   16243138
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Locked          =   -1  'True
         Label           =   "Description"
         BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         LabelWidth      =   1280
         TextBoxWidth    =   3505
         Enabled         =   0   'False
      End
      Begin ITGControls.ITGTextBox txtFromCode 
         Height          =   285
         Left            =   120
         TabIndex        =   5
         Top             =   360
         Width           =   2580
         _ExtentX        =   4339
         _ExtentY        =   503
         SendKeysTab     =   -1  'True
         LabelBackColor  =   16243138
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         AllCaps         =   -1  'True
         Label           =   "Item No."
         BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         LabelWidth      =   1280
         TextBoxWidth    =   1240
      End
      Begin ITGControls.ITGTextBox txtFromPart 
         Height          =   285
         Left            =   3090
         TabIndex        =   6
         Top             =   360
         Width           =   1830
         _ExtentX        =   3122
         _ExtentY        =   503
         BackColor       =   14737632
         LabelBackColor  =   16243138
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Locked          =   -1  'True
         Label           =   ""
         BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         LabelWidth      =   0
         TextBoxWidth    =   1770
         Enabled         =   0   'False
      End
   End
   Begin MSComctlLib.StatusBar sbRS 
      Align           =   2  'Align Bottom
      Height          =   255
      Left            =   0
      TabIndex        =   0
      Top             =   3510
      Width           =   5385
      _ExtentX        =   9499
      _ExtentY        =   450
      _Version        =   393216
      BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
         NumPanels       =   2
         BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   3528
            MinWidth        =   3528
         EndProperty
         BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
         EndProperty
      EndProperty
   End
End
Attribute VB_Name = "frmToolChangeProduct"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Object variables




Public sBit As String

Public lACNew As Boolean
Public lACEdit As Boolean
Public lACDelete As Boolean
Public lACPost As Boolean
Public lACCancel As Boolean
Public lACPrint As Boolean

Sub SaveChanges()
Dim cmdRS As New ADODB.Command
rs.CursorLocation = adUseClient

    cn.Execute ("UPDATE ITEM SET cItemNo = '" & Trim(txtToCode) & "'  WHERE cItemNo = '" & Trim(txtFromCode) & "' and cPartNo = '" & Trim(txtFromPart) & "' and cCompanyID = '" & COID & "'")
    If GetValueFrTable("cItemNo", "ITEM", "cItemNo = '" & Trim(txtToCode) & "'") <> "" Then
        If chkDelete.Value = 1 Then
            cn.Execute ("DELETE FROM ITEM WHERE cItemNo = '" & Trim(txtToCode) & "' and cPartNo = '" & Trim(txtToPart) & "' and cCompanyID = '" & COID & "'")
        End If
    End If
    
    With cmdRS
        .ActiveConnection = cn
        .CommandTimeout = 1000
        .CommandText = "erp_sp_ChangeProductID"
        .CommandType = adCmdStoredProc
        .Parameters("@cCompanyID") = COID
        .Parameters("@cOldItemNo") = Trim(txtFromCode)
        .Parameters("@cNewItemNo") = Trim(txtToCode)
        .Parameters("@cBarcodeID") = Trim(txtFromPart)

        If chkDelete.Value = 1 Then
            .Parameters("@cCondition") = "Delete"
        Else
            .Parameters("@cCondition") = "Retain"
        End If
    End With
    Set rs = cmdRS.Execute()
    
    MsgBox "Record/s successfully saved.", vbInformation, msgTtl
    
    Set rs = Nothing
    txtFromCode = ""
    txtFromDesc = ""
    txtFromPart = ""
    txtToCode = ""
    txtToDesc = ""
    txtToPart = ""
 End Sub
 
 'Close active window
Public Sub TBCloseWindow()
    Unload Me
End Sub

Private Sub cmdPickFrom_Click()
If lPickListActive Then Exit Sub
    frmITGPicker.zType = QProduct
    frmITGPicker.Show vbModal
    txtFromCode = frmITGPicker.zCode
    txtFromDesc = frmITGPicker.zName
    txtFromPart = frmITGPicker.zPart
    If Trim(txtFromDesc) <> "" Then SendKeys "{Tab}"
End Sub

Private Sub cmdPickTo_Click()
If lPickListActive Then Exit Sub
    frmITGPicker.zType = QProduct
    frmITGPicker.Show vbModal
    txtToCode = frmITGPicker.zCode
    txtToDesc = frmITGPicker.zName
    txtToPart = frmITGPicker.zPart
    If Trim(txtToDesc) <> "" Then SendKeys "{Tab}"
End Sub

Private Sub Form_Activate()
    TBBitReload
End Sub

Private Sub Form_Load()
    Set FrmName = Me
    FormSetup
    
    AcessBit Me, GetValueFrTable("AccessLevel", "SEC_ACCESSLEVEL", "RoleID = '" & SecUserRole & "' AND [Module] = 'TL11'")
    TBBitReload
End Sub

Private Sub Form_Unload(Cancel As Integer)
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , , , , , , , True
    
    
    
    
    Set frmToolChangeProduct = Nothing
    
    lCloseWindow = True
    CloseMenuTab ITGLedgerMain
    
'    'oForm(Me.Tag).Mode = 1
'    'oForm(Me.Tag).Tag = Me.Tag
End Sub

'Reload menu buttons (do not delete this sub)
Public Sub TBBitReload()
    Set FrmName = Me
    BitVisible ITGLedgerMain.tbrMain, True, True
     sBit = "0000000100001000"
    BitReload ITGLedgerMain, Me, ITGLedgerMain.tbrMain, sBit
End Sub

'Save all changes
Public Sub TBSave()
    SaveChanges
End Sub



